﻿@model TS2015.Models.TbThiSinh

@{
    ViewBag.Title = "SearchCandidate";
    AjaxOptions aj = new AjaxOptions
    {
        InsertionMode = InsertionMode.Replace,
        UpdateTargetId = "result",
        LoadingElementId = "loading-icon",
        OnFailure = "AjaxFailure",
        OnBegin = "AjaxBegin",
        OnComplete = "AjaxComplete"
    };
}


@using (Ajax.BeginForm(aj))
{
    @Html.AntiForgeryToken()
    <header class="panel-heading">
        <h3 style="text-align: center; font-weight: bold">Tìm kiếm Thí sinh</h3>
    </header>
    <div class="panel-body">
        <div class="form-horizontal">
            <div class="form-group">
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Mã TS:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.TextBoxFor(m => m.MaTS, new { @class = "form-control" })
                    </div>
                </div>
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Họ đệm:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.TextBoxFor(m => m.HoDem, new { @class = "form-control", data_val = "false" })
                    </div>
                </div>
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Tên:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.TextBoxFor(m => m.Ten, new { @class = "form-control", data_val = "false" })
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-lg-12 col-md-12 row">
                    <label>Hộ khẩu thường trú:</label>
                </div>
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Tỉnh:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.DropDownList("MaTinh", (SelectList)ViewBag.Tinh, String.Empty, new { @class = "form-control", data_val = "false", id = "ProvinceIDS1" })
                    </div>
                </div>
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Huyện:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.DropDownListFor(m => m.MaHuyen, new SelectList(Enumerable.Empty<SelectListItem>(), "MaHuyen", "TenHuyen"), String.Empty, new { @class = "form-control", data_val = "false", id = "CommuneIDS1" })
                    </div>
                </div>
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Địa chỉ:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.TextBoxFor(m => m.DiaChi, new { @class = "form-control", data_val = "false" })
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-lg-4 col-md-4 row"></div>
                <div class="col-lg-8 col-md-8 row">
                    <label>Nơi tốt nghiệp:</label>
                </div>
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">CMND:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.TextBoxFor(m => m.CMND, new { @class = "form-control", data_val = "false" })
                    </div>
                </div>
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Tỉnh:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.DropDownList("MaTinh2", (SelectList)ViewBag.Tinh, String.Empty, new { @class = "form-control", id = "ProvinceIDS" })
                    </div>
                </div>
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Trường THPT:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.DropDownListFor(m => m.IDTruong, new SelectList(Enumerable.Empty<SelectListItem>(), "IDTruong", "TenTruong"), String.Empty, new { @class = "form-control", data_val = "false", id = "HighSchoolIDS" })
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Số báo danh:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.TextBoxFor(m => m.SBD, new { @class = "form-control" })
                    </div>
                </div>
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Điện thoại:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.TextBoxFor(m => m.SoDienThoai, new { @class = "form-control", data_val = "false" })
                    </div>
                </div>
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Hệ đào tạo:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.DropDownList("HDT", (SelectList)ViewBag.HeDaoTao, String.Empty, new { @class = "form-control", id = "TrainingSystemID3" })
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Khối thi:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.DropDownList("MaKhoiThi", (SelectList)ViewBag.KhoiThi, String.Empty, new { @class = "form-control", id = "GroupID3" })
                    </div>
                </div>
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Ngành:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.DropDownList("MaNganh", new SelectList(Enumerable.Empty<SelectListItem>()), String.Empty, new { @class = "form-control", id = "PhylumID3", data_val = "false" })
                    </div>
                </div>
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Chuyên ngành:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.DropDownListFor(m => m.MaChuyenNganh, new SelectList(Enumerable.Empty<SelectListItem>(), "MaChuyenNganh", "TenChuyenNganh"), String.Empty, new { @class = "form-control", data_val = "false", id = "MajorID3" })
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-offset-1 col-md-10">
                    <input type="submit" value="Tìm kiếm" class="btn btn-danger" id="SearchList" />
                </div>
            </div>
        </div>
    </div>
}
@*<div id="grid"></div>*@
<div id="result"></div>

<script>
    $("#ProvinceIDS1").change(function () {
        var provinceid = $(this).val();
        $("#CommuneIDS1").html('').append($('<option/>', {
            value: 0,
            text: "Chọn Huyện..."
        }));
        $.getJSON("/CandidateManagement/GetProvinceByCommune", { matinh: provinceid },
               function (data) {
                   var select = $("#CommuneIDS1");
                   select.empty();
                   select.append($('<option/>', {
                       value: 0,
                       text: "Chọn Huyện..."
                   }));
                   $.each(data, function (index, itemData) {
                       select.append($('<option/>', {
                           value: itemData.Value,
                           text: itemData.Text
                       }));
                   });
               });
    });
    $("#ProvinceIDS").change(function () {
        var provinceid2 = $(this).val();
        $("#HighSchoolIDS").html('').append($('<option/>', {
            value: 0,
            text: "Chọn Trường..."
        }));
        $.getJSON("/CandidateManagement/GetHighSchoolByProvince", { matinh: provinceid2 },
               function (data) {
                   var select = $("#HighSchoolIDS");
                   select.empty();
                   select.append($('<option/>', {
                       value: 0,
                       text: "Chọn Trường..."
                   }));
                   $.each(data, function (index, itemData) {
                       select.append($('<option/>', {
                           value: itemData.Value,
                           text: itemData.Text
                       }));
                   });
               });
    });
    $("#TrainingSystemID3").change(function () {
        var TSID = $(this).val();
        $("#GroupID3").change(function () {
            $("#PhylumID3").html('').append($('<option/>', {
                value: 0,
                text: "Chọn Ngành..."
            }));
            var groupid = $(this).val();
            $.getJSON("/Common/GetPhylumByGroup", { HDT: TSID, makhoithi: groupid },
                    function (data) {
                        var select = $("#PhylumID3");
                        select.empty();
                        select.append($('<option/>', {
                            value: 0,
                            text: "Chọn Ngành..."
                        }));
                        $.each(data, function (index, itemData) {
                            select.append($('<option/>', {
                                value: itemData.Value,
                                text: itemData.Text
                            }));
                        });
                    });
        });
    });
    $("#PhylumID3").change(function () {
        var phylumid = $(this).val();
        $("#MajorID3").html('').append($('<option/>', {
            value: 0,
            text: "Chọn Chuyên ngành..."
        }));
        $.getJSON("/Common/GetMajorByPhylum", { manganh: phylumid },
               function (data) {
                   var select = $("#MajorID3");
                   select.empty();
                   select.append($('<option/>', {
                       value: 0,
                       text: "Chọn Chuyên ngành..."
                   }));
                   $.each(data, function (index, itemData) {
                       select.append($('<option/>', {
                           value: itemData.Value,
                           text: itemData.Text
                       }));
                   });
               });
    });
</script>